<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>主页 | 米尔豪斯酒店网上订餐</title>
    <link rel="stylesheet" type="text/css" href="../css/message.css">
    <link rel="stylesheet" type="text/css" href="../css/page.css">
</head>
<body>
<div class="all">
    <div class="all1">
        <div class="home">
            <div class="header">
                <div class="header1">
                    <div class="name">
                        <a href="index.php"><h1>米尔豪斯</h1></a>
                    </div>
                    <div class="guide">
                        <ul>
                            <li><a href="cart.php">购物车</a></li>
                            <li><a href="../register.html">注&nbsp;册</a></li>
                            <li><a href="../login.html">登&nbsp;陆</a></li>
                            <li><a href="zhongcan_order.php">点&nbsp;餐</a></li>
                            <li><a href="consult.php">留&nbsp;言</a></li>
                            <li><a href="index.php">主&nbsp;页</a></li>
                        </ul>
                    </div>
                </div>
            </div>

            <div class="header2">
                <div class="header3">
                    <h1>Leave comments</h1>
                 </div>
            </div>

            <div class="bottom2">
                <img src="../img/border.png" alt="底线">
            </div>
        </div>

        <div class="middle">
            <div class="middle1">
                <ul>
                    <li><a href="index.php">主页</a></li>
                    <li class="middle3">/</li>
                    <li class="middle2">留言</li>
                </ul>
            </div>
            <div class="bottom1">
                <img src="../img/border.png" alt="底线">
            </div>
        </div>
    </div>
<?php
    session_start();
    header("Content-type:text/html;charset=utf-8");
    include "../../lib/DB.php";
    include "../../lib/Pagination.php";
    $db = new DB();
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $pageSize = isset($_GET['pageSize']) ? abs($_GET['pageSize']) : 10;
    $liuyan = $db->table('liuyan')->page($page,$pageSize)->order('id desc')->select();
    $count = "select count(*) as count from  liuyan";
    $goodsCount = $db->table('liuyan')->query($count)['0']['count'];
    $pagination = new Pagination($goodsCount,$pageSize);

 ?>
    <div class="all2">
        <div class="message">
            <form  action="message.php" method="post">
                <textarea rows="5" cols="80"  placeholder="   请输入想对本酒店说的话......" name="liuyan" id="liuyan" class="liuyan"></textarea>
                <button class="sublime">提交</button>
            </form>        
        </div>

        <div class="message2">
            <div class="message1" >

                <?php foreach ($liuyan as $row):?>
            <p><?php echo $row['content'] ?><span><?php echo $row['createtime'] ?></span></p>
                <?php endforeach;?>

             </div>
        </div>
    </div>
    <div class="" style="margin-left: 22%;margin-bottom: 2%">

        <?php echo $pagination->links();?>
    </div>


    <div class="footer">
        <h1>欢迎来到米尔豪斯酒店订餐</h1>
    </div>

</div>
</body>
</html>